import { connect } from 'react-redux'
import Carts from '../components/Carts'
import { checkout } from '../actions'

const mapStateToProps = (state, ownProps) => {
  return {
    products: state.carts.products,
    price: state.carts.count
  }
}

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    checkout: (price) => {
      dispatch(checkout(price))
    }
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(Carts)
